<?php

/**
 * @author 
 * @copyright 2009
 */

if (!defined('PUBLIC_HTML'))
{
	exit;
}

function bevestiging ($conmsg) {
	
	// Aanroepvoorbeeld:
	// bevestiging("Hier uw bericht");
	
	echo "
	<script type='text/javascript'>
	window.alert('" . $conmsg . "')
	</script>
	";
	
}

function redirect ($url) 
{
	//Header('Location: '.$url);
	echo '<script type="text/javascript">
	window.location = "' . $url . '"
	</script>';

	
}

function errortop($message)
{
    echo "
    <div class='error'>
    	<table align='center'>
    		<tr>
    			<td>
    				<img alt='Error' src='http://vacature.adena.nl/img/icons/error.png' />
    			</td>
    			<td>
    				<h6 class='foutmelding'>".$message."</h6>
                </td>
            </tr>
        </table>
        <div id='fadetop'>
            <img alt='fade' class='fadetop' src='http://vacature.adena.nl/img/icons/deletesmall.png' />
        </div>
    </div>
    ";
}
    
function confirmtop($message)
{
    echo "
    <div class='error'>
    	<table align='center'>
    		<tr>
    			<td>
    				<img alt='Error' src='http://vacature.adena.nl/img/icons/error.png' />
    			</td>
    			<td>
    				<h6 class='foutmelding'>".$message."</h6>
    			</td>
    		</tr>
    	</table>
    </div>
    ";
}

if(function_exists('lcfirst') === false)
    {
        function lcfirst($str)
            {
                $str[0] = strtolower($str[0]);
                return $str;
            }
    }

function send_mail ($to, $toinfo, $from, $from_email, $subject, $message)
    {
	    // To send HTML mail, the Content-type header must be set
    	$headers  = 'MIME-Version: 1.0' . "\r\n";
    	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    	// Additional headers
        $headers .= 'From: '.$from.' <'.$from_email.'>';

    	// Mail it
    	mail($to, $subject, $message, $headers);
    }

function checkspaces($string)
    {
        // Define an array of all HTML characters you want to consider spaces
        $spaces = array('&nbsp;');

        // first, create a comparable string by changing all HTML characters in your list to real spaces
        $checked_string = str_replace($spaces, ' ', $string);

        // Now, simply make sure that the string isn't spaces from beginning to end:
        if (preg_match('|^\s*\z|', $checked_string))
            {
                return 1;
            }
    }
 
function add_meta_tags($type, $value='')
{
	if (is_array($type))
	{
		foreach ($type as $key => $content)
		{
			$meta .= '<meta http-equiv="'.$key.'" content="'.$content.'" />';
		}
	}
	else
	{
		$meta = '<meta http-equiv="'.$type.'" content="'.$value.'" />';
	}
	return $meta;
}
   
function activate_error($message, $error='')
{
	global $html;
	global $config;
	
	$error = (empty($error)) ? 'Geen technische specificaties meegegeven' : $error;
	
	$html['error'] .=
	'
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<meta name="robots" content="noindex, nofollow" />
	
	<style type="text/css">
	
	</style>
	
	<title>Foutmelding | '.$config->get('site_name').'</title>
	</head>
	<body>
	
	<div id="global">
		
		<table id="error_box">
			<tr>
				<th colspan="2">Foutmelding</th>
			</tr>
			<tr>
				<td>Bericht:</td>
				<td>'.$message.'</td>
			</tr>
			<tr>
				<td>Technisch:</td>
				<td>'.$error.'</td>
			</tr>
		</table>
	
	</div>
	
	</body>
	</html>
	';
	
	return exit;
}
?>